<?php

/**
 * CaisseRecapitulatif form base class.
 *
 * @method CaisseRecapitulatif getObject() Returns the current form's model object
 *
 * @package    SdCommerce
 * @subpackage form
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormGeneratedTemplate.php 29553 2010-05-20 14:33:00Z Kris.Wallsmith $
 */
abstract class BaseCaisseRecapitulatifForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'id'              => new sfWidgetFormInputHidden(),
      'reference'       => new sfWidgetFormTextarea(),
      'observation'     => new sfWidgetFormTextarea(),
      'total_debit'     => new sfWidgetFormInputText(),
      'total_credit'    => new sfWidgetFormInputText(),
      'montant_total'   => new sfWidgetFormInputText(),
      'date'            => new sfWidgetFormDate(),
      'date_creation'   => new sfWidgetFormDate(),
      'id_caisse'       => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Caisse'), 'add_empty' => true)),
      'id_representant' => new sfWidgetFormInputText(),
      'id_user'         => new sfWidgetFormInputText(),
      'id_vehicule'     => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Vehicule'), 'add_empty' => true)),
      'created_at'      => new sfWidgetFormDateTime(),
      'updated_at'      => new sfWidgetFormDateTime(),
    ));

    $this->setValidators(array(
      'id'              => new sfValidatorChoice(array('choices' => array($this->getObject()->get('id')), 'empty_value' => $this->getObject()->get('id'), 'required' => false)),
      'reference'       => new sfValidatorString(array('max_length' => 500, 'required' => false)),
      'observation'     => new sfValidatorString(array('max_length' => 1024, 'required' => false)),
      'total_debit'     => new sfValidatorNumber(array('required' => false)),
      'total_credit'    => new sfValidatorNumber(array('required' => false)),
      'montant_total'   => new sfValidatorNumber(array('required' => false)),
      'date'            => new sfValidatorDate(array('required' => false)),
      'date_creation'   => new sfValidatorDate(array('required' => false)),
      'id_caisse'       => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('Caisse'), 'required' => false)),
      'id_representant' => new sfValidatorInteger(array('required' => false)),
      'id_user'         => new sfValidatorInteger(array('required' => false)),
      'id_vehicule'     => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('Vehicule'), 'required' => false)),
      'created_at'      => new sfValidatorDateTime(),
      'updated_at'      => new sfValidatorDateTime(),
    ));

    $this->widgetSchema->setNameFormat('caisse_recapitulatif[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'CaisseRecapitulatif';
  }

}
